require(['loading','wx-footer'], function(loading,wxFooter) {

    //应用实例化
    var personal = new Vue({
        el: '#personal',
        data: {
            detail: {},
            payPasswordUrl:'',
            showLoading: false,
            apiUrl: wxUrl + '/v3.2/tuser/index',
            item: {
                params:{
                    token: token,
                    userToken: userToken
                }
            }
        },
        ready: function() {
            this.getPersonalData()
        },
        methods: {
            getPersonalData: function() {
                this.$http.get(this.apiUrl, this.item)
                    .then(function(response) {
                        var result = JSON.parse(response.body);
                        var complete = result.data.complete;
                        if(complete){
                            var detailData = result.data;
                            this.$set('detail', detailData);
                        }else{
                            promptBox("您须填写完善所有信息");
                           /* setTimeout(function(){
                                location.href='./personalData.html';
                            },2000);*/

                        }
                        var hasPayPassword=result.data.hasPayPassword;
                        if(hasPayPassword){
                            this.$set('payPasswordUrl', '../userCenter/passwordManagement.html');
                        }else{
                        	 this.$set('payPasswordUrl', '../userCenter/passwordManagement.html');
                            //this.$set('payPasswordUrl', '../userCenter/paymentPassword.html');
                        }
                    },function(response) {
                        //errorCallback
                    });
            }
        }
    });
});

/** 
var preTimestamp = -1;
window.addEventListener("popstate", function() {
		var nowTimestamp = (new Date()).valueOf();
		if (preTimestamp > 0 && nowTimestamp - preTimestamp < 1000*3) { // 3秒内重复点击返回按钮，则退出应用
			window.history.go(-window.history.length);
		} else {
			preTimestamp = nowTimestamp;
			history.pushState({}, document.title, null);
		}
});
**/

// 为可控制返回指定页面所有添加pushState
history.pushState({}, document.title, null);
pushVHistory();
window.addEventListener("popstate", function() {
	goBackVHistory();
});	
